package com.humanminoritygame.model.mock;

import java.util.Iterator;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;

import com.humanminoritygame.model.AnswerType;
import com.humanminoritygame.model.Category;
import com.humanminoritygame.model.Room;
import com.humanminoritygame.model.RoomRepo;

public class MockRoomRepo implements RoomRepo {
  private SortedSet<Room> rooms = new TreeSet<Room>();

  public MockRoomRepo(){
  }

  @Override
  public Set<Room> getRoomsByCategory(Category category) {
    Iterator<Room> i = rooms.iterator();
    Set<Room> result = new TreeSet<Room>();
    while(i.hasNext()){
      Room resp = i.next();
      if(resp.getCategory().equals(category)){
        result.add(resp);
      }
    }
    return result;
  }

  @Override
  public SortedSet<Room> getRooms() {
    return rooms;
  }

  @Override
  public Room addRoom(Room room) {
    rooms.add(room);
    return room;
    //TODO: considerar que pasa cuando las salas tienen la misma frecuencia
  }

  @Override
  public void removeRoom(Room room) {
    rooms.remove(room);
    
  }

  @Override
  public Room getRoomById(Long roomId) {
    // TODO Auto-generated method stub
    return null;
  }

  @Override
  public Set<Room> getOpenRooms() {
    // TODO Auto-generated method stub
    return null;
  }

  @Override
  public AnswerType getLastRoomResult(Long roomId) {
    // TODO Auto-generated method stub
    return null;
  }

  @Override
  public SortedSet<Room> getClosedRooms() {
    // TODO Auto-generated method stub
    return null;
  }
}
